package com.doit.demo.day02.sources;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.types.LongValue;
import org.apache.flink.util.LongValueSequenceIterator;

/**
 * @DATE 2022/2/15/22:48
 * @Author MDK
 * @Version 2021.2.2
 **/
public class ParCollectionSource1 {
    public static void main(String[] args) throws Exception {
        Configuration configuration = new Configuration();
        configuration.setInteger("rest.port",8081);
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStreamSource<LongValue> nums = env.fromParallelCollection(new LongValueSequenceIterator(1, 10), LongValue.class);
        System.out.println("fromParallelCollection创建的DataStream的并行度:"+nums.getParallelism());

        nums.print();
        env.execute();
    }
}
